import {
  wxRequest
} from '../../../utils/server.js';
const _wxRequest = new wxRequest();
const app = getApp()
Page({
  data: {
    imgUrl: app.globalData.imgUrl,
  },

  //账号登陆
  accountLogin: function(e) {
    var formdata = e.detail.value
    if (formdata.newPassword.length < 6) {
      wx.showToast({
        icon: 'none',
        title: '密码长度不能小于6位',
      })
      return
    }

    if (formdata.newPassword != formdata.newPassword2) {
      wx.showToast({
        icon: 'none',
        title: '新密码和确认密码不一致',
      })
      return
    }
    var that=this
    _wxRequest.wxTonkenAjax({
      url: app.globalData.apiUrl + '/sys/protected/user/changePwd',
      method: 'POST',
      data: formdata
    }, (res) => {
      wx.showToast({ 
        title: '修改成功',
      })
      wx.removeStorageSync('Authorization', '');
      wx.removeStorageSync('userInfo');
      wx.removeStorageSync('authorized');
      
      setTimeout(()=>{
        wx.navigateTo({
          url: '/pages/login/login',
        })
      },1000)
    })
  },








})